import request from '@/utils/request'

// 查询发布列表
export function listRelease(projectId,query) {
  return request({
    url: '/user/project/release/list/'+projectId,
    method: 'get',
    params: query
  })
}
export function listAllRelease(projectId,query) {
  return request({
    url: '/user/project/release/listAll/'+projectId,
    method: 'get',
    params: query
  })
}

// 查询发布详细
export function getRelease(releaseId) {
  return request({
    url: '/user/project/release/' + releaseId,
    method: 'get'
  })
}

// 新增发布
export function addRelease(projectId,data) {
  return request({
    url: '/user/project/release/'+projectId,
    method: 'post',
    data: data
  })
}

// 修改发布
export function updateRelease(projectId,data) {
  return request({
    url: '/user/project/release/'+projectId,
    method: 'put',
    data: data
  })
}

// 删除发布
export function delRelease(releaseId) {
  return request({
    url: '/user/project/release/' + releaseId,
    method: 'delete'
  })
}

// 添加迭代到发布
export function addSprintForRelease(releaseId,sprintId) {
  return request({
    url: '/user/project/release/addSprint/' + releaseId+'/'+sprintId,
    method: 'post'
  })
}

// 移除迭代到
export function removeSprintForRelease(releaseId,sprintId) {
  return request({
    url: '/user/project/release/removeSprint/' + releaseId+'/'+sprintId,
    method: 'post'
  })
}
